<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>我的微博列表</title>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

</head>
<body>
<div class="container">
    <table class="table ">
        <tr>
            <th>id</th>
            <th>内容</th>
            <th>时间</th>
            <th colspan="2">操作</th>
        </tr>

        <tr v-for="weibo in arr">
            <td>{{weibo.id}}</td>
            <td>{{weibo.content}}</td>
            <td>{{weibo.created}}</td>
<!--            <td><a data-toggle="modal" data-target="#myModal" @click="getemp(emp)">修改</a></td>-->
            <td><a @click="del(weibo.id)">删除</a></td>
        </tr>
    </table>
</div>
<!--引入axios框架-->
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<!--引入vue框架-->
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
    let v = new Vue({
        el:"table",
        data:{
            arr:[]
        },
        methods:{
            del:function (id) {
                if(confirm("确认删除!")){
                    axios.get("delete?id="+id).then(function () {
                        alert("删除成功");
                        location.reload();
                    })
                }
            }
        },
        created:function () {
            axios.get("/selectmyweibo").then(function (response) {
                v.arr = response.data;
            })
        }
    })
</script>
</body>
</html>